<% add_decidim_page_title(proposal_wizard_step_title(action_name)) %>

<% append_stylesheet_pack_tag "decidim_proposals", media: "all" %>
<% append_javascript_pack_tag "decidim_proposals" %>

<%= render layout: "layouts/decidim/shared/layout_center" do %>

  <%= render partial: "wizard_header", locals: { callout_help_text_class: "warning" } %>

  <div class="proposal__container my-10 flex flex-col gap-4">
    <h2 class="h3 text-secondary"><%= present(@proposal).title(html_escape: true) %></h2>

    <% unless component_settings.participatory_texts_enabled? %>
      <%= cell "decidim/coauthorships", @proposal, context_actions: [] %>
    <% end %>

    <div class="editor-content">
      <%= render_proposal_body(@proposal) %>
    </div>

    <% if component_settings.geocoding_enabled? && has_position?(@proposal) %>
      <div class="static-map__container">
        <%= render partial: "decidim/shared/static_map", locals: { icon_name: "proposals", geolocalizable: @proposal } %>
      </div>
    <% end %>

    <%= cell "decidim/tab_panels", tab_panel_items %>
    <%= cell "decidim/tags", @proposal %>
  </div>

  <div class="form__wrapper-block flex-col-reverse md:flex-row justify-between">
    <%= link_to destroy_draft_proposal_path(@proposal), method: :delete, class: "button button__sm md:button__lg button__text-secondary", data: { confirm: t("discard_confirmation", scope: "decidim.proposals.proposals.edit_draft") } do %>
      <%= icon "arrow-left-line" %>
      <span><%= t("discard", scope: "decidim.proposals.proposals.edit_draft") %></span>
    <% end %>

    <%= link_to t("modify", scope: "decidim.proposals.proposals.preview"), edit_draft_proposal_path(@proposal), class: "button button__sm md:button__lg button__transparent-secondary md:ml-auto" %>

    <%= button_to publish_proposal_path(@proposal), method: :post, class: "button button__sm md:button__lg button__secondary w-full md:w-fit" do %>
      <span><%= t("publish", scope: "decidim.proposals.proposals.preview") %></span>
      <%= icon "arrow-right-line" %>
    <% end %>
  </div>
<% end %>
